<script >
import { onLaunch, onShow, onHide } from '@dcloudio/uni-app'
import user from './utils/user'
import global from '@/utils/global'
import { confirm } from './utils/util'
import { share } from '@/utils/share'
import { useStore } from 'vuex';
import _store from '@/store/index.js';
(async function () {
    console.log('调用了')
    const res = await user.login()
    _store.commit('setTabBarList', !res?.isShowRankingList ? 'tab1' : 'tab2')
    _store.commit('switchToRankList', !res?.isShowRankingList)
    _store.commit('setIsSupplier', res?.isShowRankingList)
    console.log(global.token,'global.tokenglobal.token');
    setTimeout(() => {
        if (!global.token) {
            uni.redirectTo({
                url: '/pages/login/index'
            })
        } else if (user.auditStatus === 0) {
            // uni.redirectTo({ url: '/pages/toExamine/toExamine' })
            uni.redirectTo({ url: '/pages/toExamine/toExamine?type=success&title=等待审核' })
        } else if (user.auditStatus === 2) {
            uni.redirectTo({ url: '/pages/toExamine/toExamine?type=warn&title=你已离职' })
        }
    }, 0)
}())
// onLaunch(async (res) => {
//     // try {
//     //     await user.login()
//     // } catch (e) {

//     //     // if (!/login/.test(res.path)) {
//     //     //     await confirm('您还未登录，是否立即登录？')
//     //     //     uni.navigateTo({
//     //     //         url: '/pages/login/index'
//     //     //     })
//     //     // }
//     // }
//     console.log('调用啦')
//     // try {
//     await user.login()
//     setTimeout(() => {
//         if (!global.token) {
//             uni.redirectTo({
//                 url: '/pages/login/index'
//             })
//         } else if (user.auditStatus === 0) {
//             // uni.redirectTo({ url: '/pages/toExamine/toExamine' })
//             uni.redirectTo({ url: '/pages/toExamine/toExamine?type=success&title=等待审核' })
//         } else if (user.auditStatus === 2) {
//             uni.redirectTo({ url: '/pages/toExamine/toExamine?type=warn&title=你已离职' })
//         }
//     }, 0)
// })
onShow(async () => {
    //  else if (global.token && user.auditStatus === 1) {
    //     uni.redirectTo({ url: '/pages/index/index' })
    // }
    // } catch (e) {
    // }
    console.log('App show')
    // share()
})
onHide(() => {
    console.log('App Hide')
})

// onLoad(() => {
//     wx.showShareMenu({
//         withShareTicket: true,
//         /* //设置下方的Menus菜单，才能够让发送给朋友与分享到朋友圈两个按钮可以点击 */
//         menus: ['onShareAppMessage', 'onShareTimeline']
//     })
// })

</script>
<style lang="scss">
.container {
    font-size: $uni-font-size-base;
    color: $uni-text-color;
    width: 100vw;
    overflow: hidden;
}

.green {
    color: $uni-color-green;
}

.red {
    color: $uni-color-red;
}

.blue {
    color: $uni-color-blue;
}

.yellow {
    color: $uni-color-yellow;
}

.grey {
    color: $uni-text-color-grey;
}

// 三角下拉图标
.triangle {
    width: 0;
    height: 0;
    border: 10rpx solid;
    border-color: black transparent transparent transparent;
    display: inline-block;
    position: relative;
    vertical-align: middle;
    left: 6rpx;

    &.active {
        top: -5rpx;
        position: relative;
        border-color: transparent transparent black transparent;
    }
}

// 基础块
.block {
    width: 690rpx;
    margin: 30rpx auto;
}

.flex {
    display: flex;
}

.align-start-flex {
    align-items: flex-start !important;
}

.row {
    @include flex-between;
}

.align-flex {
    @include flex-align;
}

.flex-evenly {
    @include flex-evenly;
}

.flex-center {
    @include flex-center;
}

.bg {
    position: absolute;
    z-index: -1;
}

.bold {
    font-weight: bold;
}

// 长按钮
.long-btn:not([size='mini']) {
    width: 690rpx;
    height: 94rpx;
    @include flex-center();
    background: #3E5FF5;
    border-radius: 94rpx;
    font-size: $uni-font-size-h4;
    color: white;
    font-weight: 400;
    margin-top: $uni-spacing-col-lg;
}

// 短按钮
.short-btn:not([size='mini']) {
    @include flex-center();
    color: white;
    font-weight: 400;
    width: 264rpx;
    height: 94rpx;
    background: #3E5FF5;
    border-radius: 30vw;
    font-size: $uni-font-size-h4;
    margin: 0;

    &::after {
        content: unset;
    }
}

.short-btn.white {
    background-color: white;
    color: $uni-text-color;
    border: 1px solid $uni-border-color;
}

.short-btn.blue {
    background-color: #3E5FF5;
    color: $uni-text-color;
    border: 1px solid $uni-border-color;
    color: #ffffff;
}

// 按钮被禁用
.long-btn[disabled]:not([size='mini']) {
    background-color: $uni-text-color-disable;
    color: white;
}

// 底部按钮
.foot-btn {
    position: fixed;
    z-index: 10;
    bottom: 0;
    left: 0;
    width: 100vw;
    background-color: white;
    box-shadow: 0px -2rpx 0 0 #f2f2f2;
    @include flex-center();
    padding: $uni-spacing-col-sm 0;

    .long-btn {
        margin-top: 0;
    }
}

// 三个点
.more {
    height: 30rpx;
    @include flex-center();

    .point {
        width: 6rpx;
        height: 6rpx;
        border-radius: 6rpx;
        background-color: #202428;
        float: left;
        margin-right: 6rpx;
    }
}

// 状态前的 ·
.dot {
    font-weight: bold;
    margin: 0 6rpx;
    font-size: $uni-font-size-h4;
}

// input基础样式
%input {
    width: 700rpx;
    height: 89rpx;
    line-height: 89rpx;
    font-size: $uni-font-size-lg;
    @include padding(0 0 0 24rpx);
    background: white;
    border-radius: $uni-border-radius-base;
    border: 1px solid $uni-border-color;
    margin-top: $uni-spacing-col-sm;
}

// 基础form表单
.form {
    .key {
        margin-top: 30rpx;
    }

    .input {
        @extend %input;
    }

    .plach {
        color: $uni-text-color-grey;
    }

    .textarea {
        width: 700rpx;
        height: 214rpx;
        background: #f7f9fa;
        border-radius: 8rpx;
        font-size: $uni-font-size-lg;
        margin-top: $uni-spacing-col-sm;
        @include padding(30rpx);
    }

    &.alert-form {
        .input {
            width: 600rpx;
        }
    }
}

.input-box {
    position: relative;
    display: flex;
    align-items: center;

    .input {
        padding-left: 76rpx;
        @extend %input;
    }

    image.before-icon,
    image.after-icon {
        width: 32rpx;
        height: 32rpx;
        top: 20px;
    }

    .before-icon {
        position: absolute;
        left: 30rpx;
        top: 26px;
    }

    .after-icon {
        position: absolute;
        right: 30rpx;
        left: unset;
        top: 26px;
    }

    .plach {
        color: $uni-text-color-grey;
    }
}

// label标签
.label {
    width: 120rpx;
    height: 42rpx;
    @include flex-center();
    color: $uni-color-warning;
    background-color: rgba($uni-color-warning, 0.1);
    margin: $uni-spacing-col-sm $uni-spacing-col-sm 0 0;
    border-radius: $uni-border-radius-sm;
}

.text-over {
    overflow: hidden; //超出的文本隐藏
    text-overflow: ellipsis; //溢出用省略号显示
    white-space: nowrap; //溢出不换行
}

::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
    color: transparent;
}

.clear-btn {
    background: unset;
    border: unset;
    box-shadow: unset;
    margin-left: unset;
    margin-right: unset;
    padding-right: unset;
    padding-left: unset;
    line-height: unset;
    text-align: unset;
    font-size: unset;
    box-sizing: unset;
    position: unset;

    &:after {
        content: unset;
    }
}

// 客户全局样式
.customer {
    @include padding(30rpx 26rpx);
    border-bottom: 1px solid $uni-border-color;

    &-msg-row {
        margin-top: 16rpx;
    }

    &-head {
        font-weight: bold;
        font-size: $uni-font-size-h4;
    }
}

// 搜索
.search-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #ffffff;
    position: relative;
    border-radius: 44rpx;

    .search-icon {
        position: absolute;
        left: 40rpx;
    }

    .search-input {
        width: 100%;
        height: 88rpx;
        border-radius: 12rpx;
        // margin-left: 10rpx;
        background: #ffffff;
        padding-left: 85rpx;
        box-sizing: border-box;
        font-size: 28rpx;
        border-radius: 44rpx;
    }
}

// 提醒签单详情头部
.detail-head {
    padding: 40rpx 30rpx;
    background: #3e5ff5;

    .head-top {
        align-items: flex-start;
    }

    .head-info {
        .title {
            color: #ffffff;
            font-size: $font-large;
        }

        .name {
            color: rgba(255, 255, 255, 0.75);
            font-size: $uni-font-size-lg;
            margin-top: 16rpx;
        }
    }

    .head-close {
        font-size: 28rpx;
        color: #FFA814;
    }

    .head-close-grey {
        color: #FFFFFF;
    }

    .company-box {
        margin-top: 30rpx;
    }

    .company-customer {
        padding: 31rpx 24rpx;
        background: #ffffff;
        border-radius: 16rpx 16rpx 0 0;
        @include flex-between;
        color: $grey;
        font-size: $uni-font-size-lg;
        border-bottom: 1rpx solid #f4f4f7;
    }

    .company-contacts {
        padding: 31rpx 24rpx;
        background: #ffffff;
        border-radius: 0 0 16rpx 16rpx;
        @include flex-between;
        color: $grey;
        font-size: $uni-font-size-lg;
    }

    .title {
        display: flex;
        align-items: center;
        color: $black;
        font-size: $font-normal;
    }

    .contacts-list {
        display: flex;
        align-items: center;
        margin-right: 12rpx;
    }

    .contacts-i {
        width: 48rpx;
        height: 48rpx;
        margin-left: -25rpx;
        border-radius: 50%;
    }

    .arrow-img {
        width: 36rpx;
        height: 36rpx;
    }
}

// 昨天小窗口的样式
.fatalism {
    display: flex;
    align-items: center;
    box-sizing: border-box;
    padding: 12rpx 15rpx;
    background: #ffffff;
    border-radius: 8rpx;
    border: 1px solid #dee0e3;

    .fatalism-dropdown {
        width: 28rpx;
        height: 28rpx;
        margin-left: 10rpx;
    }
}

// 灰色单元块
.block-box-i {
    width: calc(100% / 2.3);
    background: #F4F4F7;
    padding: 23rpx 0 23rpx 30rpx;
    border-radius: 16rpx;

    .title {
        color: #565868;
        // font-weight: bold;
        font-size: 20rpx;
    }

    .num {
        color: $black;
        font-weight: bold;
        font-size: $font-large;
        margin-top: 10rpx;
    }

    .company {
        font-size: $font-small;
    }
}

.block-box-i-active {
    flex: 1;
}

/* 饼图table栏 */
.operate-table {
    margin-top: 20rpx;

    .table-title {
        border: 16rpx 16rpx;
    }

    .title {
        width: calc(100% / 3);
        text-align: center;
        height: 88rpx;
        line-height: 88rpx;
        background: #F4F4F7;
    }

    .cell {
        width: calc(100% / 3);
        text-align: center;
        height: 88rpx;
        line-height: 88rpx;
        background: #FAFAFC;
        color: #565868;
    }

    .cell-active {
        display: flex;
        align-items: center;
    }

    .colour-block {
        background: #3E5FF5;
        border-radius: 4rpx;
        width: 16rpx;
        height: 16rpx;
        margin: 0 12rpx 0 30rpx;
    }
}

/* 数据框盒子 如：运营数据、销售数据等等 */
.bosom {
    margin: 30rpx;
    padding: 30rpx;
    box-sizing: border-box;
    background: #fff;
    border-radius: 16rpx;

    .vendition {
        font-size: $font-normal;
        color: $black;
    }

    .screen-i {
        border-radius: 8rpx;
        border: 1rpx solid #dee0e3;
        padding: 12rpx 15rpx;
        color: #565868;
        font-size: $font-base;
    }

    .drop-down {
        width: 22rpx;
        height: 20rpx;
    }

    .title {
        color: #565868;
        // font-weight: bold;
        font-size: $font-small;
    }

    .box-list {
        margin-top: 30rpx;

        .block-box-i {
            width: 300rpx;
        }

        .block-box-i-left {
            margin-left: 30rpx;
        }
    }

    .block-box-i-active {
        width: 600rpx;
        margin-top: 30rpx;
    }

    .circulate {
        font-size: $font-normal;
        font-weight: normal;
        color: $black;
        padding-top: 30rpx;
    }

    .interval {
        padding-top: 30rpx;
    }

    .jamb {
        .amount {
            color: $blue;
            padding: 12rpx 25rpx;
            border: 1px solid #DEE0E3;
            border-radius: 12rpx 0 0 12rpx;
            background: $blue;
        }

        .sum {
            padding: 12rpx 25rpx;
            background: #fff;
            border: 1px solid #EBEFFE;
            border-radius: 0 12rpx 12rpx 0;
        }
    }

    .graphic {
        width: 12rpx;
        height: 12rpx;
        background: $blue;
        border-radius: 4rpx;
        margin-right: 8rpx;
    }
}

.transverse-down {
    width: 24rpx;
    height: 24rpx;
    margin-left: 8rpx;
}

.sequence-time {
    padding: 20rpx 30rpx 27rpx 29rpx;
    display: flex;
    justify-content: space-between;

    .specific-blue {
        color: $blue;
    }

    .hook {
        width: 20rpx;
        height: 13rpx;
        color: $blue;
    }
}

//弹窗样式
.pop-up {
    border-radius: 16rpx;

    .choices {
        width: 750rpx;
        height: 564rpx;
        background: #ffffff;
        opacity: 1;
        box-sizing: border-box;
        padding: 30rpx;
        border-radius: 16rpx;

        .custom-img {
            width: 36rpx;
            height: 36rpx;
        }

        .select-while {
            font-size: $font-medium;
            font-weight: bold;
            color: $black;
            padding: 30rpx;
        }
    }

    .choices-picker {
        height: 800rpx;
    }

    .sequence-time {
        padding: 20rpx 30rpx 27rpx 29rpx;
        display: flex;
        justify-content: space-between;

        .specific-blue {
            color: $blue;
        }

        .hook {
            width: 20rpx;
            height: 13rpx;
            color: $blue;
        }
    }
}

.pop-up .choices-picker {
    height: 900rpx;
}

.table-title,
.table-cell {
    font-size: 28rpx;
}

.bosom .title {
    font-size: 28rpx;
}

.vendition-row,
.trend-row {
    padding-bottom: 40rpx;
}

// 下拉框

.tip {
    position: absolute;
    width: 100%;
    max-height: 60vw;
    overflow: auto;
    top: 16vw;
    right: 0;
    z-index: 1000;
    background: $white;
    border-radius: 16rpx;
    font-size: 28rpx;
}

.tip-li {
    padding: 3.6vw 8vw 4vw;
}

.tip-li:hover,
.tip-li.active {
    background: #E9EEF9;
    color: $green;
}

.tip.worker-search-tip {
    position: absolute;
    width: 30vw;
    max-height: 60vw;
    overflow: auto;
    top: 13vw;
    left: 0;
    z-index: 1037;
    background: $white;
    border-radius: 16rpx;
}

.tip.worker-search-tip .tip-li {
    padding: 3.6vw 5vw 2vw;
}

.block-box-i .title {
    font-weight: normal;
    font-size: 20rpx;
}

.font-weight {
    font-weight: bold
}

/*每个页面公共css */
/* //设置圆角 */
checkbox.round .wx-checkbox-input,
checkbox.round .uni-checkbox-input {
    border-radius: 100upx;
    border: 2px solid #ccc;
}

/* //设置背景色 */
checkbox.red[checked] .wx-checkbox-input,
checkbox.red.checked .uni-checkbox-input {
    background-color: #5370f4 !important;
    border-color: #5370f4 !important;
    color: #ffffff !important;
}

uni-checkbox .uni-checkbox-input.uni-checkbox-input-checked:before {
    content: '\2022';
}

.uni-icons {
    display: none !important;
}

.uni-date-range {
    color: #202536 !important;
    font-size: 32rpx !important;
}

.uni-datetime-picker--btn,
.uni-calendar-item--checked,
.uni-calendar-item--after-checked,
.uni-calendar-item--before-checked {
    background-color: #3E5FF5 !important;
}

.uni-date-editor--x {
    display: flex !important;
    justify-content: flex-start !important;
    text-align: flex-start !important;

    input {
        text-align: flex-start !important;
    }
}

.uni-date__x {
    padding: 0 !important;
}

.t-c {
    padding: 0 !important;
}

.fs-24 {
    font-size: 24rpx;
}

.fs-28 {
    font-size: 28rpx;
}

.fs-36 {
    font-size: 36rpx;
}

.mg-r-16 {
    margin-right: 16rpx;
}

.mg-t-10 {
    margin-top: 10rpx;
}

.mg-b-30 {
    margin-bottom: 30rpx;
}

.mg-b-10 {
    margin-bottom: 10rpx;
}

.mg-t-60 {
    margin-top: 60rpx;
}

.mg-t-24 {
    margin-top: 24rpx;
}

.pd-t-30 {
    padding-top: 30rpx;
}

.pd-b-30 {
    padding-bottom: 30rpx;
}

/* //元素使用的时候就是使用 round 和 red */
</style>
